import request from "@/utils/request";
const BASE_URL = "/api/v1/temple-info";
export interface TempleListResponse {
  list: TempleItem[];
  total: number;
}

export interface TempleItem {
  id: number | string;
  templeName: string;
  subTitle: string;
  location: string;
  longitude: number;
  latitude: number;
  intro: string;
  coverImage: string;
  imageArray: string;
  historyArray: string;
  manager: string;
  managerPhone: string;
  contributor: string;
  openingHours: string;
  status: number;
  notes: string;
  createTime: string;
  updateTime: string;
  updateBy: number | null;
  createBy: number | null;
}

/**
 * 获取宗祠列表
 * @param params 分页参数
 */
export function getTempleList(params: any) {
  return request<TempleListResponse>({
    url: `${BASE_URL}/page`,
    method: "GET",
    data: params,
  });
}

/**
 * 获取宗祠详情
 * @param id 宗祠ID
 */
export function getTempleDetail(id: string | number) {
  return request<TempleItem>({
    url: `${BASE_URL}/${id}/form`,
    method: "GET",
  });
}
/**
 * 新增宗祠
 */
export function createTemple(data: any) {
  return request<TempleItem>({
    url: `${BASE_URL}`,
    method: "POST",
    data,
  });
}
